import java.util.Scanner;
import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-10-09
 * Time: 14:28
 */
public class Exam1009 {
    public static boolean chkParenthesis(String A, int n) {
        // write code here
        Stack<Character> stack = new Stack<>();
        for (Character c :
                A.toCharArray()) {
            if (c != ')' && c != '(' && c != '[' && c != ']' && c != '{' && c != '}') {
                return false;
            } else {
                if(c == '(' || c == '[' || c == '{') {
                    stack.push(c);
                } else {
                    if(stack.empty()) {
                        return false;
                    }
                    char p = stack.peek();
                    if(p == '(' && c != ')') {
                        return false;
                    } else if (p == '[' && c != ']') {
                        return false;
                    } else if (p == '{' && c != '}') {
                        return false;
                    } else {
                        stack.pop();
                    }
                }
            }
        }
        return stack.empty();
    }
    public static void main(String[] args) {
        System.out.println(chkParenthesis("((())", 5));
        String s = "6956664033";
        for (char c: s.toCharArray()) {
            System.out.println(c);
            if(c == '6') {
                break;
            } else {
                return;
            }
        }
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;
        int p = 1;
        int[] num = new int[1000000];
        num[0] = 0;
        num[1] = 1;
        int i = 2;
        for(i = 2; p < n; i++) {
            num[i] = num[i - 1] + num[i - 2];
            p = num[i];
        }
        count = Math.min(Math.abs(num[i - 1] - n), Math.abs(num[i - 2] - n));
        System.out.println(count);
    }
}
